/**
 *
 * User: Zhikang.Peng
 * Date: 2018/06/20 14:52
 */
package references

import "gitee.com/thghh/jvmgo/instructions/base"
import "gitee.com/thghh/jvmgo/rtda"

type ARRAY_LENGTH struct {
	base.NoOperandsInstruction
}

func (self *ARRAY_LENGTH) Execute(frame *rtda.Frame) {
	stack := frame.OperandStack()
	arrayRef := stack.PopReference()
	if arrayRef == nil {
		panic("java.lang.NullPointerException")
	}
	arrayLen := arrayRef.ArrayLength()
	stack.PushInt(arrayLen)
}
